// 缓存布局路由，防止重加载
const Layout = () => import('../layout/index.vue')

export const baseRoutes = [
  {
    path: '/',
    name: 'home',
    component: Layout,
    redirect: '/welcome',
    meta: {
      icon: 'HomeFilled',
      title: '首页',
      showLink: true
    },
    children: [
      {
        path: '/welcome',
        name: 'welcome',
        component: () => import('../views/welcome/index.vue'),
        meta: {
          title: '首页'
        }
      }
    ]
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/login/index.vue'),
    meta: {
      title: '登录'
    }
  },
  {
    path: '/error',
    name: 'error',
    component: Layout,
    redirect: '/error/403',
    meta: {
      title: '错误',
      rank: 9
    },
    children: [
      {
        path: '/error/403',
        name: '403',
        component: () => import('@/views/error/403.vue'),
        meta: {
          title: '无权限访问'
        }
      },
      {
        path: '/error/404',
        name: '404',
        component: () => import('@/views/error/404.vue'),
        meta: {
          title: '页面不存在'
        }
      },
      {
        path: '/error/500',
        name: '500',
        component: () => import('@/views/error/500.vue'),
        meta: {
          title: '服务器错误'
        }
      }
    ]
  },
  {
    path: '/:pathMatch(.*)',
    name: 'notFound',
    redirect: '/error/404'
  }
]
